Skip to content

VideoRecording: Complete refactor from Tutorial with instructional/podcast flags#1228

Merged
maebeale merged 102 commits intomainfrom
maebeale/video-gallery-flag
Mar 9, 2026
Merged

VideoRecording: Complete refactor from Tutorial with instructional/podcast flags#1228
maebeale merged 102 commits intomainfrom
maebeale/video-gallery-flag

Conversation

@maebeale
Copy link
Collaborator

@maebeale maebeale commented Feb 25, 2026

Summary

Complete refactor of the Tutorial model to VideoRecording with boolean flags for flexible content categorization. Implements semantic parameter naming with is_instructional and is_podcast flags. Help menu displays instructional videos, Community menu shows Video Gallery with general videos.

Key Changes

Model & Database

  • Rename tutorials table to video_recordings
  • Add is_instructional boolean flag (default: false for most, true for 2 instructional videos)
  • Add is_podcast boolean flag (default: false)
  • Add database indexes on both flags for query performance

Controllers & Routes

  • Rename TutorialsControllerVideoRecordingsController
  • Consolidate non-RESTful video_library action into RESTful index action with parameters
  • Video type filtering via video_type parameter:
    • instructional → shows is_instructional: true videos (Help menu)
    • other → shows is_instructional: false videos (Community menu)
    • all → shows all videos
  • Always display search boxes on all pages

Views & UI

  • Rename views directory: tutorials/video_recordings/
  • Move view specs: spec/views/tutorials/spec/views/video_recordings/
  • Update page titles and navigation links (desktop, mobile)
  • Update all form labels and button text

Controllers, Models & Services

  • Fix remaining Tutorial references in:
    • Analytics controller (event names)
    • Taggings controller (pagination parameters)
    • Admin cards helper (model card reference)
    • Bookmark specs (comment text)
  • Update ActionText search to use plain_text_body instead of raw HTML
  • Update admin helper to reference video_recordings model

Data & Seeds

  • Restore complete seed data (Organizations, Workshops, Resources, Events, Stories, FAQs, etc.)
  • VideoRecordings seeds:
    • 2 videos marked as is_instructional: true (educational content)
    • 4 videos marked as is_instructional: false (general/reference content)
    • Mixed published states for testing visibility
  • Workshop Variations:
    • Random published state (2:1 ratio published:unpublished)
    • First 2 promoted to WorkshopVariationIdeas (1 unpublished, 1 published)
  • WindowsType references use sentence case ("Adult", "Children", "Combined")

Tests

  • Migrate specs: spec/views/tutorials/*.rbspec/views/video_recordings/*.rb
  • Update all test references from Tutorial to VideoRecording
  • Update form field names in specs
  • Update page_bg_class alignment spec

Test Plan

  • Migrate database successfully with db:migrate
  • Fix all Tutorial references throughout codebase
  • Migrate and update view specs
  • Update analytics and tagging controllers
  • Restore full seed data with proper VideoRecording structure
  • Visit Help > Videos → shows only is_instructional: true videos
  • Visit Community > Video Gallery → shows only is_instructional: false videos
  • Home page embed → displays featured videos
  • Video Type dropdown filters work correctly
  • Admin form → can toggle is_instructional and is_podcast flags
  • Seeds run successfully: db:seed
  • Search works with ActionText plain text body
  • All specs pass: bundle exec rspec
  • No remaining Tutorial references in non-archived code

🤖 Generated with Claude Code

@maebeale maebeale force-pushed the maebeale/video-gallery-flag branch from d1cbee0 to ee7b6f3 Compare February 26, 2026 17:18
@maebeale maebeale changed the title Add display_in_video_gallery flag to split Tutorials and Video Gallery HOLD: Add display_in_video_gallery flag to split Tutorials and Video Gallery Feb 27, 2026
@maebeale maebeale force-pushed the maebeale/video-gallery-flag branch from ee7b6f3 to feb2e00 Compare February 28, 2026 22:56
@maebeale maebeale changed the title HOLD: Add display_in_video_gallery flag to split Tutorials and Video Gallery HOLD: Convert Tutorials to Video Gallery Mar 8, 2026
@maebeale maebeale changed the title HOLD: Convert Tutorials to Video Gallery Convert Tutorials to Video Gallery Mar 8, 2026
@maebeale maebeale marked this pull request as draft March 8, 2026 10:40
@maebeale maebeale force-pushed the maebeale/video-gallery-flag branch from feb2e00 to 6733078 Compare March 8, 2026 18:06
@maebeale maebeale changed the title Convert Tutorials to Video Gallery Rename Tutorial model to VideoRecording with is_tutorial/is_podcast flags Mar 8, 2026
@maebeale maebeale changed the title Rename Tutorial model to VideoRecording with is_tutorial/is_podcast flags VideoRecording: Refactor Tutorial model with boolean flags for content categorization Mar 8, 2026
@maebeale maebeale marked this pull request as ready for review March 8, 2026 19:01
@maebeale maebeale changed the title VideoRecording: Refactor Tutorial model with boolean flags for content categorization VideoRecording: Complete refactor from Tutorial with instructional/podcast flags Mar 8, 2026
<%= @tutorial.rhino_body %>
<div class="prose leading-relaxed text-gray-800 text-left text-start pb-10 mb-10">
<%= @video_recording.rhino_body %>
</div>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure we want this wrapper div?

@maebeale maebeale requested a review from jmilljr24 March 9, 2026 01:40
@maebeale maebeale force-pushed the maebeale/video-gallery-flag branch from af1a6ce to bc36ff5 Compare March 9, 2026 15:42
maebeale and others added 16 commits March 9, 2026 11:51
- Rename tutorials table to recordings via migration
- Add is_tutorial (default: true) and is_podcast (default: false) columns
- Rename Tutorial model to Recording with backwards-compatibility alias
- Add scopes: .tutorials (is_tutorial: true), .podcasts (is_podcast: true)
- Rename TutorialsController to RecordingsController
  - Add video_library action for all recordings
  - Index action filters to is_tutorial: true only
- Update routes: resources :recordings, /tutorials redirects to index, /video_library route
- Rename home VideoGalleryController to VideoLibraryController, update to use Recording
- Rename and update views: tutorials → recordings, video_gallery → video_library
- Rename and update policy: TutorialPolicy → RecordingPolicy
- Rename and update factory: tutorial → recording, add :tutorial/:podcast/:both traits
- Help menu shows Tutorials (is_tutorial: true)
- Community menu shows Video Library (all recordings)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Update all views: recordings/_form, _search_boxes, _tutorial, _video_card, edit, index, index_lazy, new, show
- Replace @tutorial with @recording, tutorial[...] with recording[...], edit_tutorial_path with edit_recording_path
- Add is_tutorial and is_podcast checkboxes to form (admin section)
- Update navigation menus:
  - Help: Tutorials link uses Recording model name (Tutorials)
  - Community: Add "Video Library" link pointing to video_library_path
- Update both desktop and mobile navbars
- Update i18n: add Recording model names, keep Tutorial alias
- Fix Cancel link to use recordings_path

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Rename model Recording → YoutubeVideo (self.table_name = 'youtube_videos')
- Rename controller RecordingsController → YoutubeVideosController
- Rename policy RecordingPolicy → YoutubeVideoPolicy
- Rename factory recordings.rb → youtube_videos.rb
- Rename views app/views/recordings → app/views/youtube_videos
- Update migration class name
- Update all references: Recording → YoutubeVideo, recording → youtube_video, @recording → @youtube_video
- Keep backwards-compatibility alias: Tutorial = YoutubeVideo
- Keep i18n entries for Tutorial alias

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Desktop navbar: Video Library → Video Gallery
- Mobile navbar: Video Library → Video Gallery
- Route and controller remain as video_library (internal naming)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Rename YoutubeVideo → VideoRecording throughout codebase
- Update migration: tables/indexes named video_recordings
- Update controller video_library action to exclude tutorials (is_tutorial: false)
- video_library shows all content EXCEPT tutorials (Video Gallery)
- index shows only tutorials (Tutorials under Help)
- Keep i18n singular as 'Video'

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Rename migration file: rename_tutorials_to_recordings → rename_video_recordings
- Matches class name RenameVideoRecordings

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
… reorganize views

- Rename Tutorial model to VideoRecording with self.table_name = 'video_recordings'
- Add is_tutorial and is_podcast boolean flags with scopes (default: true, false)
- Rename views directory from tutorials to video_recordings per Rails conventions
- Migrate VideoRecordingsController with index (tutorials only) and video_library actions
- Update routes: /video_recordings (main), /tutorials (alias), /video_library (action)
- Add VideoGalleryController under home namespace to show non-tutorials on home page
- Update navigation: Help section shows "Tutorials", Community shows "Video Gallery"
- Update i18n: Tutorial.model_name → "Video" (singular), "Tutorials" (plural)
- Add 13 diverse seed records covering all flag combinations for testing

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Fix RuboCop style violations: change single quotes to double quotes
- Update tutorial_spec.rb to use VideoRecording model instead of Tutorial
- Update tutorials_routing_spec.rb to test VideoRecordingsController routing
- Fix Tag model reference from Tutorial to VideoRecording
- All tests and linting should now pass

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Changed source_type from 'Tutorial' to 'VideoRecording' in User model
to match the renamed model. This fixes the NameError in test suite
when accessing User#bookmarked_tutorials association.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…ndex

- Add video_type parameter support ('all', 'tutorials', 'not_tutorials')
- Merge video_library action into index with parameter-based filtering
- Add video_type dropdown filter in search UI
- Hide search boxes when video_type=tutorials parameter is set
- Update navigation links to pass appropriate query parameters:
  - Community > Video Gallery links with video_type=not_tutorials
  - Help > Tutorials links with video_type=tutorials&hide_search=true
- Update view to show different titles based on video_type
- Preserve video_type parameter in search form and clear filters link
- Add filter_by_video_type helper method to controller

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add video type dropdown as first filter in the search form
- Remove duplicate hidden field (select field handles the parameter)
- Update layout to match other filter fields
- Dropdown auto-submits on change to apply filter immediately

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Fix references to Tutorial model (use VideoRecording)
- Customize message based on video_type filter
- Show appropriate no results message for tutorials vs video gallery

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Change home_video_gallery_index_path to home_video_recordings_index_path
- Reflects renamed home video_recordings controller

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…o_recordings_index_path

- The correct path helper for resources :video_recordings is home_video_recordings_path
- _index suffix is not added for RESTful resource routes by default

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Update home/video_recordings/index view to use @video_recordings variable
- Change partial from tutorials/video_card to video_recordings/video_card
- Update video_card partial to use video_recording variable instead of tutorial
- Fix "Browse all videos" link to video_recordings_path with video_type filter
- Fixes "Oopsie!" error on home page video gallery

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
maebeale and others added 27 commits March 9, 2026 11:51
- Removed link from subtitle paragraph
- Added link to top-right section, only shown in instructional videos mode
- Link directs to non-instructional videos view

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Use bg-cyan-100 for instructional videos instead of bg-cyan-50 for better visual distinction

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Remove video_type param so link shows all videos instead of just 'other'

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Use skip_confirmation! on User and Person models to prevent Devise from
attempting to send confirmation instructions during db:seed/db:dev:seed tasks.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Add skip_confirmation = true when creating users that don't initially have
confirmed_at set. This prevents Devise from attempting to send confirmation
instructions during db:seed/db:dev:seed, which was causing mailer errors.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Add presence validation to ensure youtube_url is required when creating or updating VideoRecording records.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Replace hardcoded 'VideoRecording' strings with VideoRecording.model_name.human
so messages use the translated name ('Video') from en.yml configuration.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Remove invalid skip_confirmation attribute assignments. Instead, set
Devise.mailer to NullMailer during seeding to prevent confirmation emails
from being sent, then restore it at the end of seeding.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Pass video_type: 'all' parameter so the video type dropdown defaults to
'All videos' when clicking from the instructional videos page.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Use video_recordings domain theme color instead of resources color.
Use darker intensity (100) for instructional videos, lighter (50) for others.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Use video_card partial for consistent card-based layout (3-column grid)
- Add Edit and View buttons to the left of bookmark button on cards
- Apply home page card styling (rounded-xl, shadow-sm, hover effects)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Keep card styling but revert to 2-column layout for better use of screen space.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Stack buttons vertically on the right: Edit, Bookmark, View
- Allows title to extend further right
- Bookmark button is now thinner without View button beside it

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Bookmark button at top
- Edit and View buttons below, side by side
- Matches screenshot layout

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- View and Bookmark buttons side by side on top
- Edit button below
- Better use of space with admin-only edit row

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Remove invalid Devise.mailer = "NullMailer" which was causing seed failures.
Keep ActionMailer::Base.perform_deliveries = false which is sufficient to
prevent email delivery without trying to swap out mailer classes.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Update top utility link from 'Video gallery' to 'Videos'
- Update back button from '← Video gallery' to '← Videos'
- Change both links from video_type: 'other' to video_type: 'all'

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add confirmed_at = Time.current to all User creation blocks to prevent Devise from triggering confirmation callbacks during seeding
- Add missing windows_type_id and author_credit_preference to WorkshopVariation seed data to satisfy validations

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…d fields

Use find_or_initialize_by to ensure all required fields (windows_type_id, author_credit_preference) are set for both new and existing workshop variations.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Change tutorials_path to video_recordings_path in form URL
- Update model class references from Tutorial to VideoRecording

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@maebeale maebeale force-pushed the maebeale/video-gallery-flag branch from 2d20433 to bf2064b Compare March 9, 2026 15:51
@maebeale maebeale merged commit 17710d0 into main Mar 9, 2026
@maebeale maebeale deleted the maebeale/video-gallery-flag branch March 9, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant